<?php
namespace app\admin\controller;

class BlockOrderIp extends Base{
    //
    protected function initialize() {
        parent::initialize();
        $this->model = 'BlockOrderIp';
    }
    //
    protected function _before_index(){
        $thead = [
            'boid' => 'ID',
            'ip' => 'IP',
            'addtime' =>'创建时间',
        ];
        $this->assign('thead', $thead);
    }
    //
    protected function _filter($map){
        return $map;
    }
    //
    protected function _after_list($list){
        foreach($list as $key => $row){
            $list[$key]['addtime'] = date('Y-m-d H:i:s', $row['addtime']);
        }
        return $list;
    }
    //
    protected function _before_add(){}
    //
    protected function _before_insert($data){
        return $data;
    }
    //
    protected function _after_add($data, $id){
        $this->log(['pk' => 'boid', 'value' => $id], $data);
    }
    //
    protected function _before_edit(){}
    //
    protected function _filter_edit($list){
        return $list;
    }
    //
    protected function _before_save($data){
        return $data;
    }
    //
    protected function _after_edit($data){
        $this->log(['pk' => 'boid', 'value' => $data['boid']], $data);
    }
    //
    protected function _filter_del(){
        return [];
    }
    //
    protected function _after_del($rows){
        $logs = [];
        foreach($rows as $row){
            $logs[] = ['pk' => 'boid', 'value' => $row['boid'], 'row' => $row];
        }
        $this->logAll($logs);
    }
}